package com.neusoft.demo.server;

import com.neusoft.demo.mapper.OrdersMapper;
import com.neusoft.demo.pojo.Cart;
import com.neusoft.demo.pojo.Foods;
import com.neusoft.demo.pojo.Orders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServer {
    @Autowired(required = false)
    OrdersMapper ordersMapper;
    public java.util.List<Orders> ordersList(int userId){
        return ordersMapper.orderList(userId);
    }
    public  boolean addOrders(Orders orders){
        int n= ordersMapper.addOrders(orders);
        if(n>0){
            return  true;
        }else{
            return  false;
        }
    }
    public  boolean delOrders(int foodId){
        int n=ordersMapper.delOrders(foodId);
        if(n>0)
            return  true;
        else
            return false;
    }
    public  boolean del(Orders orders){
        int n=ordersMapper.del(orders);
        if(n>0)
            return  true;
        else
            return false;
    }
    public boolean updateOr(Orders orders){
        int n=ordersMapper.updateOr(orders);
        if(n>0){
            return true;
        }else {
            return  false;
        }
    }
    public boolean upOr(Orders orders){
        int n=ordersMapper.updateOrders(orders);
        if(n>0){
            return true;
        }else {
            return  false;
        }
    }
}
